/*    */ package com.yss.sofa.cml.design;
/*    */ 
/*    */ import com.yss.sofa.cml.Band;
/*    */ import com.yss.sofa.cml.CellElement;
/*    */ import com.yss.sofa.cml.ColumnGroup;
/*    */ import com.yss.sofa.cml.Row;
/*    */ import com.yss.sofa.cml.type.LayoutEnum;
/*    */ import java.util.ArrayList;
/*    */ import java.util.List;
/*    */ 
/*    */ public class DesignBand
/*    */   implements Band
/*    */ {
/*    */   private static final long serialVersionUID = 1L;
/*    */   private List<Row> children;
/*    */   private DesignColumnGroup columnGroup;
/*    */ 
/*    */   public CellElement[] getElements()
/*    */   {
/* 22 */     return getElements(this.children);
/*    */   }
/*    */ 
/*    */   public static CellElement[] getElements(List<Row> children) {
/* 26 */     if (children == null) {
/* 27 */       return null;
/*    */     }
/* 29 */     List elements = new ArrayList();
/* 30 */     for (Row row : children) {
/* 31 */       CellElement[] cells = row.getElements();
/* 32 */       if (cells != null) {
/* 33 */         for (CellElement cell : cells) {
/* 34 */           elements.add(cell);
/*    */         }
/*    */       }
/*    */     }
/* 38 */     CellElement[] arr = new CellElement[elements.size()];
/* 39 */     elements.toArray(arr);
/* 40 */     return arr;
/*    */   }
/*    */ 
/*    */   public DesignRow addRow() {
/* 44 */     return addRow(new DesignRow());
/*    */   }
/*    */ 
/*    */   private DesignRow addRow(DesignRow row) {
/* 48 */     if (this.children == null) {
/* 49 */       synchronized (this) {
/* 50 */         this.children = new ArrayList();
/*    */       }
/*    */     }
/* 53 */     this.children.add(row);
/* 54 */     return row;
/*    */   }
/*    */ 
/*    */   public List<Row> getChildren()
/*    */   {
/* 59 */     return this.children;
/*    */   }
/*    */ 
/*    */   public void setColumnGroup(DesignColumnGroup columnGroup) {
/* 63 */     this.columnGroup = columnGroup;
/*    */   }
/*    */ 
/*    */   public ColumnGroup getColumnGroup()
/*    */   {
/* 68 */     return this.columnGroup;
/*    */   }
/*    */ 
/*    */   public void addColumnWidth(int width) {
/* 72 */     addColumnWidth(width, LayoutEnum.FIXED);
/*    */   }
/*    */ 
/*    */   public void addColumnWidth(int width, LayoutEnum layout) {
/* 76 */     if (this.columnGroup == null) {
/* 77 */       synchronized (this) {
/* 78 */         this.columnGroup = new DesignColumnGroup();
/*    */       }
/*    */     }
/* 81 */     this.columnGroup.addColumn(new DesignColumn(width, layout));
/*    */   }
/*    */ 
/*    */   public void addPageBreak() {
/* 85 */     addRow(new DesignPageBreak());
/*    */   }
/*    */ }

/* Location:           X:\repository\com\yss\sofa\cml\cml-api\1.1.0\cml-api-1.1.0.jar
 * Qualified Name:     com.yss.sofa.cml.design.DesignBand
 * JD-Core Version:    0.6.0
 */